<?php
namespace Sys\Controller;
use Todo\Controller\CurdController;

class UserController extends CurdController {

    /**
     * 获取要编辑的数据，建议重写
     * @param $id
     * @return mixed
     */
    protected function _editData($id){
        $this->_loadModel();
        $data = $this->_model->keyFind($id);
        $roleList = $this->_model->query('SELECT role_id FROM sys_user_role WHERE user_id = '. $id);
        $data['roles'] = array_column($roleList, 'role_id');
        return $data;
    }
}